#ifndef CHATINPUTTEXTEDIT_H
#define CHATINPUTTEXTEDIT_H

#include<qtextedit.h>
#include<QKeyEvent>
#include <QMimeData>
#include <QFileInfo>
#include <QTextFragment>
#include <QTextCursor>
//#include <


class ChatInputTextEdit : public QTextEdit
{
    Q_OBJECT
public:
    explicit ChatInputTextEdit(QWidget *parent = nullptr);

    void keyPressEvent(QKeyEvent *e);
    bool switch_key_Enter = true;//控制是否启用ENTER快捷键发送消息，默认启用
protected:
    void dragEnterEvent(QDragEnterEvent *event) override;


    void dragMoveEvent(QDragMoveEvent *event) override;


    void dropEvent(QDropEvent *event) override;


    void insertFromMimeData(const QMimeData *source) override;


    void mouseDoubleClickEvent(QMouseEvent *event) override;//双击图片显示原图

private:
    void insertImage(const QImage &image);


signals:
    void sendMessage();


};

#endif // CHATINPUTTEXTEDIT_H
